﻿Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.Web.Script.Services
Imports System.Web.Script.Serialization
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Promotion
    Inherits System.Web.Services.WebService
    'Soap header
    Public loginUser As LogInUser
#Region "oCompany"
    <WebMethod()> _
    Public Function GetAllCompany(ByVal dataBaseName As String) As DataSet
        Dim promotion As New oCompany
        Return promotion.GetAllCompany(dataBaseName)
    End Function
    <WebMethod()> _
    Public Function GetCompanyByCode(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oCompany
        Return promotion.GetCompanyByCode(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonCompany(
                                       ByVal companyCode As String, ByVal companyName As String, ByVal isActive As Boolean, ByVal address As String, _
                                        ByVal contactPerson As String, ByVal contactPhone As String, _
                                       ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oCompany
        Return promotion.UpdateJsonCompany(companyCode, companyName, isActive, address, contactPerson, contactPhone, databaseName, isInsert)

    End Function
    <WebMethod()> _
    Public Function UpdateCompany(
                                         ByVal data As DataSet, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oCompany
        Return promotion.UpdateCompany(data, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonCompanyProfile(ByVal companyCode As String, ByVal address As String, _
                                        ByVal contactPerson As String, ByVal contactPhone As String, _
                                       ByVal databaseName As String) As String
        Dim promotion As New oCompany
        Return promotion.UpdateJsonCompanyProfile(companyCode, address, contactPerson, contactPhone, databaseName)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonCompanySetting(ByVal companyCode As String, ByVal pointExpireType As String, ByVal pointExpireFixedDate As DateTime, _
                                         ByVal pointExpireDays As Double, ByVal conflictMethod As String, ByVal pointChangeAction As String, ByVal gradeMethod As String, _
                                        ByVal promotionConflictMethod As String, ByVal databaseName As String) As String
        Dim promotion As New oCompany
        Return promotion.UpdateJsonCompanySetting(companyCode, pointExpireType, pointExpireFixedDate, pointExpireDays, _
                                                                conflictMethod, pointChangeAction, gradeMethod, promotionConflictMethod, databaseName)
    End Function
#End Region
#Region "oUser"
    <WebMethod()> _
    <SoapHeader("loginUser")>
    Public Function GetAllUser(ByVal dataBaseName As String) As DataSet
        'Check permission
        If loginUser IsNot Nothing Then
            If loginUser.IsValid() Then
                Dim promotion As New oUser
                Return promotion.GetAllUser(dataBaseName)
            Else
                Return Nothing
            End If
        Else
            Return Nothing
        End If
    End Function
    <WebMethod()> _
    Public Function GetUserByUserName(ByVal dataBaseName As String, ByVal userName As String) As DataSet
        Dim promotion As New oUser
        Return promotion.GetUserByUserName(dataBaseName, userName)
    End Function
    <WebMethod()> _
     <ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=False)> _
    Public Function GetLogin(ByVal dataBaseName As String, ByVal userName As String, ByVal passWord As String) As DataSet
        Try
            Dim promotion As New oUser
            Dim dsUser As DataSet = promotion.GetLogin(dataBaseName, userName, passWord)
            Return dsUser
        Catch ex As Exception
            Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod.DeclaringType(), "SystemError", ex)
        End Try
        Return Nothing
    End Function
    <WebMethod()> _
    Public Function UpdateJsonUser(
                                     ByVal oUserID As String, ByVal userName As String, ByVal CompanyCode As String, ByVal UserPassword As String, _
                                     ByVal IsAdmin As Boolean, ByVal IsActive As Boolean, ByVal IsTrial As Boolean, ByVal Email As String, ByVal Phone As String, _
                                     ByVal databaseName As String, ByVal isInsert As Boolean) As String

        Dim promotion As New oUser
        Return promotion.UpdateJsonUser(oUserID, userName, CompanyCode, UserPassword, IsAdmin, IsActive, IsTrial, Email, Phone, databaseName, isInsert)

    End Function
    <WebMethod()> _
    Public Function UpdateUser(ByVal data As DataSet, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oUser
        Return promotion.UpdateUser(data, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function ChangePassword(ByVal dataBaseName As String, ByVal userName As String, ByVal oldPassWord As String, ByVal newPassWord As String) As Integer
        Dim promotion As New oUser
        Return promotion.ChangePassword(dataBaseName, userName, oldPassWord, newPassWord)
    End Function
#End Region
#Region "oWarehouse"
    <WebMethod()> _
    Public Function GetAllWarehouse(ByVal dataBaseName As String, ByVal companyCode As String, ByVal isAdmin As Boolean) As DataSet
        Dim promotion As New oWarehouse
        Return promotion.GetAllWarehouse(dataBaseName, companyCode, isAdmin)
    End Function
    <WebMethod()> _
    Public Function GetWarehouseByCode(ByVal dataBaseName As String, ByVal WarehouseCode As String) As DataSet
        Dim promotion As New oWarehouse
        Return promotion.GetWarehouseByCode(dataBaseName, WarehouseCode)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonWarehouse(
                                        ByVal WarehouseId As String, _
                                       ByVal WarehouseCode As String, ByVal WarehouseName As String, ByVal companyCode As String, ByVal address As String, _
                                       ByVal createdUserId As String, ByVal createdDate As DateTime, ByVal isActive As Boolean, _
                                       ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oWarehouse
        Return promotion.UpdateJsonWarehouse(WarehouseId, WarehouseCode, WarehouseName, companyCode, address, createdUserId, createdDate, _
                                           isActive, databaseName, isInsert)

    End Function
    <WebMethod()> _
    Public Function DeleteJsonWarehouse(
                                      ByVal WarehouseId As String, _
                                     ByVal databaseName As String) As String
        Dim promotion As New oWarehouse
        Return promotion.DeleteJsonWarehouse(WarehouseId, databaseName)
    End Function
#End Region
#Region "oItem"
    <WebMethod()> _
    Public Function GetAllItem(ByVal dataBaseName As String, ByVal companyCode As String, ByVal isAdmin As Boolean) As DataSet
        Dim promotion As New oItem
        Return promotion.GetAllItem(dataBaseName, companyCode, isAdmin)
    End Function
    <WebMethod()> _
    Public Function GetItemsForSearch(ByVal dataBaseName As String, ByVal companyCode As String, ByVal keySearch As String) As DataSet
        Dim promotion As New oItem
        Return promotion.GetItemsForSearch(dataBaseName, companyCode, keySearch)
    End Function
    <WebMethod()> _
    Public Function GetItemByCode(ByVal dataBaseName As String, ByVal companyCode As String, ByVal itemCode As String) As DataSet
        Dim promotion As New oItem
        Return promotion.GetItemByCode(dataBaseName, companyCode, itemCode)
    End Function
    <WebMethod()> _
    Public Function GetCountItem(ByVal dataBaseName As String, ByVal companyCode As String) As Long
        Dim promotion As New oItem
        Return promotion.GetCountItem(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonItem(
                                         ByVal itemID As String, ByVal itemCode As String, ByVal itemName As String, _
                                         ByVal companyCode As String, ByVal basePrice As Double, ByVal createduserId As String, _
                                         ByVal createdDate As Date, ByVal isActive As Boolean, ByVal allowPromotion As Boolean, _
                                         ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oItem
        Return promotion.UpdateJsonItem(itemID, itemCode, itemName, companyCode, basePrice, createduserId, createdDate, isActive, allowPromotion, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function UpdateItem(
                                         ByVal data As DataSet, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oItem
        Return promotion.UpdateItem(data, databaseName, isInsert)
    End Function
#End Region
#Region "oItemProperty"
    <WebMethod()> _
    Public Function GetAllItemProperty(ByVal dataBaseName As String, ByVal companyCode As String, ByVal referenceCode As String, ByVal isAdmin As Boolean) As DataSet
        Dim promotion As New oItemProperty
        Return promotion.GetAllItemProperty(dataBaseName, companyCode, referenceCode, isAdmin)
    End Function
    <WebMethod()> _
    Public Function GetItemrPropertyByCode(ByVal dataBaseName As String, ByVal propertyCode As String, ByVal referenceCode As String) As DataSet
        Dim promotion As New oItemProperty
        Return promotion.GetItemPropertyByCode(dataBaseName, propertyCode, referenceCode)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonItemProperty(ByVal propertyID As String, _
                                    ByVal propertyCode As String, ByVal propertyName As String, ByVal companyCode As String, _
                                     ByVal createdUserId As String, ByVal propertyValueType As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oItemProperty
        Return promotion.UpdateJsonItemProperty(propertyID, propertyCode, propertyName, companyCode, createdUserId, propertyValueType, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonItemProperty(ByVal dataBaseName As String, ByVal propertyID As String) As String
        Dim promotion As New oItemProperty
        Return promotion.DeleteJsonItemProperty(dataBaseName, propertyID)
    End Function
#End Region
#Region "oItemPropertyDetail"
    <WebMethod()> _
    Public Function GetAllItemPropertyDetail(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oItemPropertyDetail
        Return promotion.GetAllItemPropertyDetail(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetAllItemPropertyDetailByPropertyID(ByVal dataBaseName As String, ByVal propertyID As String) As DataSet
        Dim promotion As New oItemPropertyDetail
        Return promotion.GetAllItemPropertyDetailByPropertyID(dataBaseName, propertyID)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonItemPropertyDetail(ByVal propertyID As String, _
                                    ByVal propertyDetailCode As String, ByVal propertyDetailName As String, ByVal propertyDetailID As String, _
                                    ByVal createdUserId As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oItemPropertyDetail
        Return promotion.UpdateJsonItemPropertyDetail(propertyID, propertyDetailCode, propertyDetailName, propertyDetailID, createdUserId, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonItemPropertyDetail(ByVal dataBaseName As String, ByVal propertyDetailID As String) As String
        Dim promotion As New oItemPropertyDetail
        Return promotion.DeleteJsonItemPropertyDetail(dataBaseName, propertyDetailID)
    End Function

#End Region
#Region "oItemPropertyLink"
    <WebMethod()> _
    Public Function GetAllItemPropertyLink(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oItemPropertyLink
        Return promotion.GetAllItemPropertyLink(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetAllItemPropertyLinkByItem(ByVal dataBaseName As String, ByVal propertyID As String, ByVal itemID As String) As DataSet
        Dim promotion As New oItemPropertyLink
        Return promotion.GetAllItemPropertyLinkByItem(dataBaseName, propertyID, itemID)
    End Function

    <WebMethod()> _
    Public Function DeleteJsonItemPropertyLink(ByVal dataBaseName As String, ByVal propertyLinkID As String) As String
        Dim promotion As New oItemPropertyLink
        Return promotion.DeleteJsonItemPropertyLink(dataBaseName, propertyLinkID)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonItemPropertyLink(ByVal customerID As String, ByVal propertyDetailID As String, _
                                 ByVal propertyLinkID As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oItemPropertyLink
        Return promotion.UpdateJsonItemPropertyLink(customerID, propertyDetailID, propertyLinkID, databaseName, isInsert)
    End Function

#End Region
#Region "oCustomer"
    <WebMethod()> _
    Public Function GetAllCustomer(ByVal dataBaseName As String, ByVal companyCode As String, ByVal isAdmin As Boolean) As DataSet
        Dim promotion As New oCustomer
        Return promotion.GetAllCustomer(dataBaseName, companyCode, isAdmin)
    End Function
    <WebMethod()> _
    Public Function GetCustomersForSearch(ByVal dataBaseName As String, ByVal companyCode As String, ByVal keySearch As String) As DataSet
        Dim promotion As New oCustomer
        Return promotion.GetCustomersForSearch(dataBaseName, companyCode, keySearch)
    End Function
    <WebMethod()> _
    Public Function GetCustomerByCode(ByVal dataBaseName As String, ByVal companyCode As String, ByVal customerCode As String) As DataSet
        Dim promotion As New oCustomer
        Return promotion.GetCustomerByCode(dataBaseName, companyCode, customerCode)
    End Function
    <WebMethod()> _
    Public Function GetCountCustomer(ByVal dataBaseName As String, ByVal companyCode As String) As Long
        Dim promotion As New oCustomer
        Return promotion.GetCountCustomer(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function UpdateCustomer(
                                         ByVal data As DataSet, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oCustomer
        Return promotion.UpdateCustomer(data, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonCustomer(ByVal customerId As String, _
                                       ByVal customerCode As String, ByVal customerName As String, ByVal companyCode As String, _
                                       ByVal CreatedUserId As String, ByVal createdDate As DateTime, ByVal isActive As Boolean, ByVal billingAddress As String, _
                                       ByVal shippingAddress As String, ByVal contactPerson As String, _
                                       ByVal phoneNumber As String, ByVal email As String, ByVal birthDay As DateTime, ByVal specialDay As DateTime, _
                                        ByVal gradeID As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oCustomer
        Return promotion.UpdateJsonCustomer(customerId, customerCode, customerName, companyCode, CreatedUserId, createdDate, _
                                           isActive, billingAddress, shippingAddress, contactPerson, phoneNumber, email, birthDay, specialDay, gradeID, databaseName, isInsert)

    End Function
#End Region
#Region "oCustomerProperty"
    <WebMethod()> _
    Public Function GetAllCustomerProperty(ByVal dataBaseName As String, ByVal companyCode As String, ByVal referenceCode As String, ByVal isAdmin As Boolean) As DataSet
        Dim promotion As New oCustomerProperty
        Return promotion.GetAllCustomerProperty(dataBaseName, companyCode, referenceCode, isAdmin)
    End Function
    <WebMethod()> _
    Public Function GetCustomerPropertyByCode(ByVal dataBaseName As String, ByVal propertyCode As String, ByVal referenceCode As String) As DataSet
        Dim promotion As New oCustomerProperty
        Return promotion.GetCustomerPropertyByCode(dataBaseName, propertyCode, referenceCode)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonCustomerProperty(ByVal propertyID As String, _
                                    ByVal propertyCode As String, ByVal propertyName As String, ByVal companyCode As String, _
                                    ByVal createdUserId As String, ByVal propertyValueType As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oCustomerProperty
        Return promotion.UpdateJsonCustomerProperty(propertyID, propertyCode, propertyName, companyCode, createdUserId, propertyValueType, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonCustomerProperty(ByVal dataBaseName As String, ByVal propertyID As String) As String
        Dim promotion As New oCustomerProperty
        Return promotion.DeleteJsonCustomerProperty(dataBaseName, propertyID)
    End Function
#End Region
#Region "oCustomerPropertyDetail"
    <WebMethod()> _
    Public Function GetAllCustomerPropertyDetail(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oCustomerPropertyDetail
        Return promotion.GetAllCustomerPropertyDetail(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetAllCustomerPropertyDetailByPropertyID(ByVal dataBaseName As String, ByVal propertyID As String) As DataSet
        Dim promotion As New oCustomerPropertyDetail
        Return promotion.GetAllCustomerPropertyDetailByPropertyID(dataBaseName, propertyID)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonCustomerPropertyDetail(ByVal propertyID As String, _
                                    ByVal propertyDetailCode As String, ByVal propertyDetailName As String, ByVal propertyDetailID As String, _
                                    ByVal createdUserId As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oCustomerPropertyDetail
        Return promotion.UpdateJsonCustomerPropertyDetail(propertyID, propertyDetailCode, propertyDetailName, propertyDetailID, createdUserId, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonCustomerPropertyDetail(ByVal dataBaseName As String, ByVal propertyDetailID As String) As String
        Dim promotion As New oCustomerPropertyDetail
        Return promotion.DeleteJsonCustomerPropertyDetail(dataBaseName, propertyDetailID)
    End Function
    <WebMethod()> _
    Public Function GetCustomerPropertyDetail(ByVal dataBaseName As String) As DataSet
        Dim promotion As New oCustomerPropertyDetail
        Return promotion.GetCustomerPropertyDetail(dataBaseName)
    End Function
#End Region
#Region "oCustomerPropertyLink"
    <WebMethod()> _
    Public Function GetAllCustomerPropertyLink(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oCustomerPropertyLink
        Return promotion.GetAllCustomerPropertyLink(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetAllCustomerPropertyLinkByCustomer(ByVal dataBaseName As String, ByVal propertyID As String, ByVal customerCode As String) As DataSet
        Dim promotion As New oCustomerPropertyLink
        Return promotion.GetAllCustomerPropertyLinkByCustomer(dataBaseName, propertyID, customerCode)
    End Function

    <WebMethod()> _
    Public Function DeleteJsonCustomerPropertyLink(ByVal dataBaseName As String, ByVal propertyLinkID As String) As String
        Dim promotion As New oCustomerPropertyLink
        Return promotion.DeleteJsonCustomerPropertyLink(dataBaseName, propertyLinkID)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonCustomerPropertyLink(ByVal customerID As String, ByVal propertyDetailID As String, _
                                 ByVal propertyLinkID As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oCustomerPropertyLink
        Return promotion.UpdateJsonCustomerPropertyLink(customerID, propertyDetailID, propertyLinkID, databaseName, isInsert)
    End Function

#End Region
#Region "oDocHeader"
    <WebMethod()> _
    Public Function UpdateJsonDocHeader(ByVal docEntry As Integer, ByVal companyCode As String, ByVal customerCode As String, ByVal customerName As Boolean, ByVal docDate As Date, _
                                      ByVal docDueDate As Date, ByVal remarks As String, ByVal subTotal As Double, ByVal createUserID As String, _
                                         ByVal docStatus As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oDocHeader
        Return promotion.UpdateJsonDocHeader(docEntry, companyCode, customerCode, customerName, docDate, docDueDate, remarks, subTotal, createUserID, docStatus, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function GetAllDocHeader(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oDocHeader
        Return promotion.GetAllDocHeader(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetDocHeaderByDocEntry(ByVal dataBaseName As String, ByVal companyCode As String, ByVal docEntry As String) As DataSet
        Dim promotion As New oDocHeader
        Return promotion.GetDocHeaderByDocEntry(dataBaseName, companyCode, docEntry)
    End Function
    <WebMethod()> _
    Public Function GetDocHeaderByCustomerForSearch(ByVal dataBaseName As String, ByVal companyCode As String, ByVal keySearch As String) As DataSet
        Dim promotion As New oDocHeader
        Return promotion.GetDocHeaderByCustomerForSearch(dataBaseName, companyCode, keySearch)
    End Function
    <WebMethod()> _
    Public Function GetCountDocument(ByVal dataBaseName As String, ByVal companyCode As String) As Long
        Dim promotion As New oDocHeader
        Return promotion.GetCountDocument(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function CreateMarketingDocument(ByVal dataBaseName As String, ByVal docEntry As String, ByVal isUpdate As Boolean, ByVal headerJson As String, ByVal lineJson As String) As String
        Dim promotion As New oDocHeader
        Return promotion.CreateMarketingDocument(dataBaseName, docEntry, isUpdate, headerJson, lineJson)
    End Function
    <WebMethod()> _
    Public Function DeleteDocument(ByVal dataBaseName As String, ByVal docEntry As String) As String
        Dim promotion As New oDocHeader
        Return promotion.DeleteDocument(dataBaseName, docEntry)
    End Function
    <WebMethod()> _
    Public Function GetLastRecordDocHeader(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oDocHeader
        Return promotion.GetLastRecordDocHeader(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function ClosedMarketingDocument(ByVal dataBaseName As String, ByVal docEntry As String, ByVal docStatus As String) As String
        Dim promotion As New oDocHeader
        Return promotion.ClosedMarketingDocument(dataBaseName, docEntry, docStatus)
    End Function
#End Region
#Region "oDocLine"
    <WebMethod()> _
    Public Function UpdateJsonDocLine(ByVal lineNum As Integer, ByVal docEntry As Integer, ByVal itemID As String, ByVal itemCode As String, ByVal itemName As String, ByVal warehouseID As String, _
                                   ByVal quantity As Double, ByVal basePrice As Double, ByVal discountPercent As Integer, ByVal discountAmt As Double, _
                                   ByVal priceAfterDiscount As Double, ByVal totalAfterDiscount As Double, _
                                   ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oDocLine
        Return promotion.UpdateJsonDocLine(lineNum, docEntry, itemID, itemCode, itemName, warehouseID, quantity, basePrice, discountPercent, discountAmt, priceAfterDiscount, totalAfterDiscount, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function GetDocLineByDocEntry(ByVal dataBaseName As String, ByVal docEntry As String) As DataSet
        Dim promotion As New oDocLine
        Return promotion.GetDocLineByDocEntry(dataBaseName, docEntry)
    End Function
#End Region
#Region "oDocPromotionGet"
    <WebMethod()> _
    Public Function GetDocPromotionGetByDocEntry(ByVal dataBaseName As String, ByVal docEntry As String) As DataSet
        Dim promotion As New oDocPromotionGet
        Return promotion.GetDocPromotionGetByDocEntry(dataBaseName, docEntry)
    End Function
    <WebMethod()> _
    Public Function GetDocPromotionGetByID(ByVal dataBaseName As String, ByVal id As String) As DataSet
        Dim promotion As New oDocPromotionGet
        Return promotion.GetDocPromotionGetByID(dataBaseName, id)
    End Function
#End Region
#Region "oDocPromotionBy"
    <WebMethod()> _
    Public Function GetDocPromotionBuyByDocEntry(ByVal dataBaseName As String, ByVal docEntry As String) As DataSet
        Dim promotion As New oDocPromotionBuy
        Return promotion.GetDocPromotionBuyByDocEntry(dataBaseName, docEntry)
    End Function
    <WebMethod()> _
    Public Function GetDocPromotionBuyByID(ByVal dataBaseName As String, ByVal id As String) As DataSet
        Dim promotion As New oDocPromotionBuy
        Return promotion.GetDocPromotionBuyByID(dataBaseName, id)
    End Function
#End Region
#Region "oDocProperty"
    <WebMethod()> _
    Public Function GetAllDocProperty(ByVal dataBaseName As String, ByVal companyCode As String, ByVal referenceCode As String, ByVal isAdmin As Boolean) As DataSet
        Dim promotion As New oDocProperty
        Return promotion.GetAllDocProperty(dataBaseName, companyCode, referenceCode, isAdmin)
    End Function
    <WebMethod()> _
    Public Function GetDocPropertyByCode(ByVal dataBaseName As String, ByVal propertyCode As String, ByVal referenceCode As String) As DataSet
        Dim promotion As New oDocProperty
        Return promotion.GetDocPropertyByCode(dataBaseName, propertyCode, referenceCode)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonDocProperty(ByVal propertyID As String, _
                                    ByVal propertyCode As String, ByVal propertyName As String, ByVal companyCode As String, _
                                      ByVal createdUserId As String, ByVal propertyValueType As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oDocProperty
        Return promotion.UpdateJsonDocProperty(propertyID, propertyCode, propertyName, companyCode, createdUserId, propertyValueType, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonDocProperty(ByVal dataBaseName As String, ByVal propertyID As String) As String
        Dim promotion As New oDocProperty
        Return promotion.DeleteJsonDocProperty(dataBaseName, propertyID)
    End Function
#End Region
#Region "oDocPropertyDetail"
    <WebMethod()> _
    Public Function GetAllDocPropertyDetail(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oDocPropertyDetail
        Return promotion.GetAllDocPropertyDetail(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetAllDocPropertyDetailByPropertyID(ByVal dataBaseName As String, ByVal propertyID As String) As DataSet
        Dim promotion As New oDocPropertyDetail
        Return promotion.GetAllDocPropertyDetailByPropertyID(dataBaseName, propertyID)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonDocPropertyDetail(ByVal propertyID As String, _
                                    ByVal propertyDetailCode As String, ByVal propertyDetailName As String, ByVal propertyDetailID As String, _
                                    ByVal createdUserId As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oDocPropertyDetail
        Return promotion.UpdateJsonDocPropertyDetail(propertyID, propertyDetailCode, propertyDetailName, propertyDetailID, createdUserId, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonDocPropertyDetail(ByVal dataBaseName As String, ByVal propertyDetailID As String) As String
        Dim promotion As New oDocPropertyDetail
        Return promotion.DeleteJsonDocPropertyDetail(dataBaseName, propertyDetailID)
    End Function

#End Region
#Region "oDocPropertyLink"
    <WebMethod()> _
    Public Function GetAllDocPropertyLink(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oDocPropertyLink
        Return promotion.GetAllDocPropertyLink(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetAllDocPropertyLinkByItem(ByVal dataBaseName As String, ByVal propertyID As String, ByVal itemID As String) As DataSet
        Dim promotion As New oDocPropertyLink
        Return promotion.GetAllDocPropertyLinkByItem(dataBaseName, propertyID, itemID)
    End Function

    <WebMethod()> _
    Public Function DeleteJsonDocPropertyLink(ByVal dataBaseName As String, ByVal propertyLinkID As String) As String
        Dim promotion As New oDocPropertyLink
        Return promotion.DeleteJsonDocPropertyLink(dataBaseName, propertyLinkID)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonDocPropertyLink(ByVal DocEntry As String, ByVal propertyDetailID As String, _
                                 ByVal propertyLinkID As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oDocPropertyLink
        Return promotion.UpdateJsonDocPropertyLink(DocEntry, propertyDetailID, propertyLinkID, databaseName, isInsert)
    End Function

#End Region
#Region "oDocLineProperty"
    <WebMethod()> _
    Public Function GetAllDocLineProperty(ByVal dataBaseName As String, ByVal companyCode As String, ByVal referenceCode As String, ByVal isAdmin As Boolean) As DataSet
        Dim promotion As New oDocLineProperty
        Return promotion.GetAllDocLineProperty(dataBaseName, companyCode, referenceCode, isAdmin)
    End Function
    <WebMethod()> _
    Public Function GetDocLinePropertyByCode(ByVal dataBaseName As String, ByVal propertyCode As String, ByVal referenceCode As String) As DataSet
        Dim promotion As New oDocLineProperty
        Return promotion.GetDocLinePropertyByCode(dataBaseName, propertyCode, referenceCode)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonDocLineProperty(ByVal propertyID As String, _
                                    ByVal propertyCode As String, ByVal propertyName As String, ByVal companyCode As String, _
                                    ByVal createdUserId As String, ByVal propertyValueType As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oDocLineProperty
        Return promotion.UpdateJsonDocLineProperty(propertyID, propertyCode, propertyName, companyCode, createdUserId, propertyValueType, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonDocLineProperty(ByVal dataBaseName As String, ByVal propertyID As String) As String
        Dim promotion As New oDocLineProperty
        Return promotion.DeleteJsonDocLineProperty(dataBaseName, propertyID)
    End Function
#End Region
#Region "oDocLinePropertyDetail"
    <WebMethod()> _
    Public Function GetAllDocLinePropertyDetail(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oDocLinePropertyDetail
        Return promotion.GetAllDocLinePropertyDetail(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetAllDocLinePropertyDetailByPropertyID(ByVal dataBaseName As String, ByVal propertyID As String) As DataSet
        Dim promotion As New oDocLinePropertyDetail
        Return promotion.GetAllDocLinePropertyDetailByPropertyID(dataBaseName, propertyID)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonDocLinePropertyDetail(ByVal propertyID As String, _
                                    ByVal propertyDetailCode As String, ByVal propertyDetailName As String, ByVal propertyDetailID As String, _
                                    ByVal createdUserId As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oDocLinePropertyDetail
        Return promotion.UpdateJsonDocLinePropertyDetail(propertyID, propertyDetailCode, propertyDetailName, propertyDetailID, createdUserId, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonDocLinePropertyDetail(ByVal dataBaseName As String, ByVal propertyDetailID As String) As String
        Dim promotion As New oDocLinePropertyDetail
        Return promotion.DeleteJsonDocLinePropertyDetail(dataBaseName, propertyDetailID)
    End Function

#End Region
#Region "oDocLinePropertyLink"
    <WebMethod()> _
    Public Function GetAllDocLinePropertyLink(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oDocLinePropertyLink
        Return promotion.GetAllDocLinePropertyLink(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetAllDocLinePropertyLinkByItem(ByVal dataBaseName As String, ByVal propertyID As String, ByVal itemID As String) As DataSet
        Dim promotion As New oDocLinePropertyLink
        Return promotion.GetAllDocLinePropertyLinkByItem(dataBaseName, propertyID, itemID)
    End Function

    <WebMethod()> _
    Public Function DeleteJsonDoLinecPropertyLink(ByVal dataBaseName As String, ByVal propertyLinkID As String) As String
        Dim promotion As New oDocLinePropertyLink
        Return promotion.DeleteJsonDocLinePropertyLink(dataBaseName, propertyLinkID)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonDocLinePropertyLink(ByVal DocEntry As String, ByVal propertyDetailID As String, _
                                 ByVal propertyLinkID As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oDocLinePropertyLink
        Return promotion.UpdateJsonDocLinePropertyLink(DocEntry, propertyDetailID, propertyLinkID, databaseName, isInsert)
    End Function

#End Region
#Region "oPromotionHeader"
    <WebMethod()> _
    Public Function GetAllPromotionHeader(ByVal dataBaseName As String) As DataSet
        Dim promotion As New oPromotionHeader
        Return promotion.GetAllPromotionHeader(dataBaseName)
    End Function
    <WebMethod()> _
    Public Function GetPromotionHeaderByCompanyCode(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oPromotionHeader
        Return promotion.GetPromotionHeaderByCompanyCode(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetPromotionHeaderByID(ByVal dataBaseName As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionHeader
        Return promotion.GetPromotionHeaderByID(dataBaseName, promotionID)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonPromotionHeader(ByVal PromotionID As String _
                                              , ByVal CompanyCode As String _
                                               , ByVal PromotionCode As String _
                                               , ByVal PromotionName As String _
                                               , ByVal FatherPromotionCode As String _
                                               , ByVal PromotionType As String _
                                               , ByVal FromDate As DateTime _
                                               , ByVal ToDate As DateTime _
                                               , ByVal FromTime As DateTime _
                                               , ByVal ToTime As DateTime _
                                               , ByVal IsActive As Boolean _
                                               , ByVal IsOpional As Boolean _
                                               , ByVal FromAmount As Double _
                                               , ByVal ToAmount As Double _
                                               , ByVal FromQuantity As Double _
                                               , ByVal ToQuantity As Double _
                                               , ByVal DiscountType As String _
                                               , ByVal DiscountValue As Double _
                                               , ByVal MaxCountApply As Double _
                                               , ByVal Monday As Boolean _
                                               , ByVal MondayStart As DateTime _
                                               , ByVal MondayEnd As DateTime _
                                               , ByVal Tuesday As Boolean _
                                               , ByVal TuesdayStart As DateTime _
                                               , ByVal TuesdayEnd As DateTime _
                                               , ByVal Wednesday As Boolean _
                                               , ByVal WednesdayStart As DateTime _
                                               , ByVal WednesdayEnd As DateTime _
                                               , ByVal Thursday As Boolean _
                                               , ByVal ThursdayStart As DateTime _
                                               , ByVal ThursdayEnd As DateTime _
                                               , ByVal Friday As Boolean _
                                               , ByVal FridayStart As DateTime _
                                               , ByVal FridayEnd As DateTime _
                                               , ByVal Saturday As Boolean _
                                               , ByVal SaturdayStart As DateTime _
                                               , ByVal SaturdayEnd As DateTime _
                                               , ByVal Sunday As Boolean _
                                               , ByVal SundayStart As DateTime _
                                               , ByVal SundayEnd As DateTime _
                                               , ByVal CreatedUserID As String _
                                               , ByVal CreatedDate As DateTime _
                                               , ByVal BudgetAmount As Double _
                                               , ByVal TargetRevenue As Double _
                                                , ByVal EveryAt As Integer _
                                               , ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionHeader
        Return promotion.UpdateJsonPromotionHeader(PromotionID, CompanyCode _
                                                   , PromotionCode _
                                                   , PromotionName _
                                                   , FatherPromotionCode _
                                                   , PromotionType _
                                                   , FromDate _
                                                   , ToDate _
                                                   , FromTime _
                                                   , ToTime _
                                                   , IsActive _
                                                   , IsOpional _
                                                   , FromAmount _
                                                   , ToAmount _
                                                   , FromQuantity _
                                                   , ToQuantity _
                                                   , DiscountType _
                                                   , DiscountValue _
                                                   , MaxCountApply _
                                                   , Monday _
                                                   , MondayStart _
                                                   , MondayEnd _
                                                   , Tuesday _
                                                   , TuesdayStart _
                                                   , TuesdayEnd _
                                                   , Wednesday _
                                                   , WednesdayStart _
                                                   , WednesdayEnd _
                                                   , Thursday _
                                                   , ThursdayStart _
                                                   , ThursdayEnd _
                                                   , Friday _
                                                   , FridayStart _
                                                   , FridayEnd _
                                                   , Saturday _
                                                   , SaturdayStart _
                                                   , SaturdayEnd _
                                                   , Sunday _
                                                   , SundayStart _
                                                   , SundayEnd _
                                                   , CreatedUserID _
                                                   , CreatedDate _
                                                   , BudgetAmount _
                                                   , TargetRevenue _
                                                   , EveryAt _
                                                   , databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function GetLastRecordPromotionHeader(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oPromotionHeader
        Return promotion.GetLastRecordPromotionHeader(dataBaseName, companyCode)
    End Function
#End Region
#Region "oReferenceValue"
    <WebMethod()> _
    Public Function GetReferenceValue(ByVal dataBaseName As String, ByVal value As String) As DataSet
        Dim promotion As New oReferenceValue
        Return promotion.GetReferenceValueByValue(dataBaseName, value)
    End Function
#End Region
#Region "oPromotionCustomerInclude"
    <WebMethod()> _
    Public Function UpdateJsonPromotionCustomerIn(ByVal lineID As String, ByVal promotionID As String, _
                                   ByVal sourceType As String, ByVal sourceValue As String, ByVal disCountCode As String, _
                                   ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionCustomerInclude
        Return promotion.UpdateJsonPromotionCustomerIn(lineID, promotionID, sourceType, sourceValue, disCountCode, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionCustomerIn(ByVal dataBaseName As String, ByVal lineID As String) As String
        Dim promotion As New oPromotionCustomerInclude
        Return promotion.DeleteJsonPromotionCustomerIn(dataBaseName, lineID)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionCustomerInByPromotionID(ByVal dataBaseName As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionCustomerInclude
        Return promotion.GetAllPromotionCustomerInByPromotionID(dataBaseName, promotionID)
    End Function
#End Region
#Region "oPromotionCustomerExclusive"
    <WebMethod()> _
    Public Function UpdateJsonPromotionCustomerEx(ByVal lineID As String, ByVal promotionID As String, _
                                   ByVal sourceType As String, ByVal sourceValue As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionCustomerExclusive
        Return promotion.UpdateJsonPromotionCustomerEx(lineID, promotionID, sourceType, sourceValue, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionCustomerEx(ByVal dataBaseName As String, ByVal lineID As String) As String
        Dim promotion As New oPromotionCustomerExclusive
        Return promotion.DeleteJsonPromotionCustomerEx(dataBaseName, lineID)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionCustomerExByPromotionID(ByVal dataBaseName As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionCustomerExclusive
        Return promotion.GetAllPromotionCustomerExByPromotionID(dataBaseName, promotionID)
    End Function
#End Region
#Region "oPromotionWarehouseInclude"
    <WebMethod()> _
    Public Function UpdateJsonPromotionWarehouseIn(ByVal lineID As String, ByVal promotionID As String, _
                               ByVal warehouseID As String, _
                               ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionWarehouseInclude
        Return promotion.UpdateJsonPromotionWarehouseIn(lineID, promotionID, warehouseID, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionWarehouseIn(ByVal dataBaseName As String, ByVal lineID As String) As String
        Dim promotion As New oPromotionWarehouseInclude
        Return promotion.DeleteJsonPromotionWarehouseIn(dataBaseName, lineID)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionWarehouseInByPromotionID(ByVal dataBaseName As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionWarehouseInclude
        Return promotion.GetAllPromotionWarehouseInByPromotionID(dataBaseName, promotionID)
    End Function
#End Region
#Region "oPromotionWarehouseExclude"
    <WebMethod()> _
    Public Function UpdateJsonPromotionWarehouseEx(ByVal lineID As String, ByVal promotionID As String, _
                               ByVal warehouseID As String, _
                               ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionWarehouseExclude
        Return promotion.UpdateJsonPromotionWarehouseEx(lineID, promotionID, warehouseID, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionWarehouseEx(ByVal dataBaseName As String, ByVal lineID As String) As String
        Dim promotion As New oPromotionWarehouseExclude
        Return promotion.DeleteJsonPromotionWarehouseEx(dataBaseName, lineID)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionWarehouseExByPromotionID(ByVal dataBaseName As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionWarehouseExclude
        Return promotion.GetAllPromotionWarehouseExByPromotionID(dataBaseName, promotionID)
    End Function
#End Region
#Region "oPromotionItemExclusive"
    <WebMethod()> _
    Public Function UpdateJsonPromotionItemEx(ByVal lineID As String, ByVal promotionID As String, _
                                  ByVal sourceType As String, ByVal sourceValue As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionItemExclusive
        Return promotion.UpdateJsonPromotionItemEx(lineID, promotionID, sourceType, sourceValue, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionItemEx(ByVal dataBaseName As String, ByVal lineID As String) As String
        Dim promotion As New oPromotionItemExclusive
        Return promotion.DeleteJsonPromotionItemEx(dataBaseName, lineID)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionItemExByPromotionID(ByVal dataBaseName As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionItemExclusive
        Return promotion.GetAllPromotionItemExByPromotionID(dataBaseName, promotionID)
    End Function
#End Region
#Region "oPromotionDocumentPropertyExclusive"
    <WebMethod()> _
    Public Function UpdateJsonPromotionDocumentPropertyEx(ByVal lineID As String, ByVal promotionID As String, _
                               ByVal propertyDetailID As String, _
                               ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionDocumentPropertyExclusive
        Return promotion.UpdateJsonPromotionDocumentPropertyEx(lineID, promotionID, propertyDetailID, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionDocumentPropertyEx(ByVal dataBaseName As String, ByVal lineID As String) As String
        Dim promotion As New oPromotionDocumentPropertyExclusive
        Return promotion.DeleteJsonPromotionDocumentPropertyEx(dataBaseName, lineID)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionDocumentPropertyExByPromotionID(ByVal dataBaseName As String, ByVal propertyID As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionDocumentPropertyExclusive
        Return promotion.GetAllPromotionDocumentPropertyExByPromotionID(dataBaseName, propertyID, promotionID)
    End Function
#End Region
#Region "oPromotionDocumentPropertyInclude"
    <WebMethod()> _
    Public Function UpdateJsonPromotionDocumentPropertyIn(ByVal lineID As String, ByVal promotionID As String, _
                               ByVal propertyDetailID As String, _
                               ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionDocumentPropertyInclude
        Return promotion.UpdateJsonPromotionDocumentPropertyIn(lineID, promotionID, propertyDetailID, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionDocumentPropertyIn(ByVal dataBaseName As String, ByVal lineID As String) As String
        Dim promotion As New oPromotionDocumentPropertyInclude
        Return promotion.DeleteJsonPromotionDocumentPropertyIn(dataBaseName, lineID)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionDocumentPropertyInByPromotionID(ByVal dataBaseName As String, ByVal propertyID As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionDocumentPropertyInclude
        Return promotion.GetAllPromotionDocumentPropertyInByPromotionID(dataBaseName, propertyID, promotionID)
    End Function
#End Region
#Region "oPromotionItemBuy"
    <WebMethod()> _
    Public Function UpdateJsonPromotionItemBuy(ByVal lineID As String, ByVal promotionID As String, _
                                 ByVal sourceType As String, ByVal sourceValue As String, ByVal buyFromQuantity As Double, _
                                 ByVal buyToQuantity As Double, ByVal buyFromAmount As Double, ByVal buyToAmount As Double, _
                                 ByVal mustHave As Boolean, ByVal discountType As String, ByVal discountValue As Double, _
                                 ByVal getFOCSameItem As Boolean, ByVal getFOCSameItemQty As Double, ByVal getStrType As String, _
                                 ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionItemBuy
        Return promotion.UpdateJsonPromotionItemBuy(lineID, promotionID, sourceType, sourceValue, buyFromQuantity, buyToQuantity, buyFromAmount, buyToAmount, mustHave, _
                                           discountType, discountValue, getFOCSameItem, getFOCSameItemQty, getStrType, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionItemBuy(ByVal dataBaseName As String, ByVal lineID As String) As String
        Dim promotion As New oPromotionItemBuy
        Return promotion.DeleteJsonPromotionItemBuy(dataBaseName, lineID)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionItemBuyByPromotionID(ByVal dataBaseName As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionItemBuy
        Return promotion.GetAllPromotionItemBuyByPromotionID(dataBaseName, promotionID)
    End Function
#End Region
#Region "oPromotionItemGet"
    <WebMethod()> _
    Public Function UpdateJsonPromotionItemGet(ByVal lineID As String, ByVal promotionID As String, _
                                  ByVal sourceType As String, ByVal sourceValue As String, ByVal discountMax As Double, _
                                  ByVal getQuantity As Double, ByVal isOptional As Boolean, _
                                  ByVal discountType As String, ByVal discountValue As Double, ByVal getStrType As String, _
                                  ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionItemGet
        Return promotion.UpdateJsonPromotionItemGet(lineID, promotionID, sourceType, sourceValue, discountMax, getQuantity, isOptional, _
                                           discountType, discountValue, getStrType, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionItemGet(ByVal dataBaseName As String, ByVal lineID As String) As String
        Dim promotion As New oPromotionItemGet
        Return promotion.DeleteJsonPromotionItemGet(dataBaseName, lineID)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionItemGetByPromotionID(ByVal dataBaseName As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionItemGet
        Return promotion.GetAllPromotionItemGetByPromotionID(dataBaseName, promotionID)
    End Function
#End Region
#Region "oCustomerGrade"
    <WebMethod()> _
    Public Function GetAllCustomerGrade(ByVal dataBaseName As String, ByVal companyCode As String, ByVal isAdmin As Boolean) As DataSet
        Dim promotion As New oCustomerGrade
        Return promotion.GetAllCustomerGrade(dataBaseName, companyCode, isAdmin)
    End Function
    <WebMethod()> _
    Public Function GetCustomerGradeByCode(ByVal dataBaseName As String, ByVal gradeCode As String) As DataSet
        Dim promotion As New oCustomerGrade
        Return promotion.GetCustomerGradeByCode(dataBaseName, gradeCode)
    End Function
    <WebMethod()> _
    Public Function GetCustomerGradeByID(ByVal dataBaseName As String, ByVal gradeID As String) As DataSet
        Dim promotion As New oCustomerGrade
        Return promotion.GetCustomerGradeByID(dataBaseName, gradeID)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonCustomerGrade(ByVal gradeID As String, _
                                          ByVal gradeCode As String, ByVal gradeName As String, ByVal companyCode As String, _
                                          ByVal createdUserId As String, ByVal minValue As Double, ByVal pointFactor As Double, _
                                          ByVal pointCurrency As Double, _
                                          ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oCustomerGrade
        Return promotion.UpdateJsonCustomerGrade(gradeID, gradeCode, gradeName, companyCode, createdUserId, minValue, pointFactor, pointCurrency, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonCustomerGrade(ByVal dataBaseName As String, ByVal gradeID As String) As String
        Dim promotion As New oCustomerGrade
        Return promotion.DeleteJsonCustomerGrade(dataBaseName, gradeID)
    End Function
#End Region
#Region "oSalesPerson"
    <WebMethod()> _
    Public Function UpdateJsonSalesPerson(ByVal salesPersonID As String, _
                                      ByVal salesPersonCode As String, ByVal salesPersonName As String, ByVal companyCode As String, _
                                      ByVal createdUserId As String, ByVal managerID As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oSalesPerson
        Return promotion.UpdateJsonSalesPerson(salesPersonID, salesPersonCode, salesPersonName, companyCode, createdUserId, managerID, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonSalesPerson(ByVal dataBaseName As String, ByVal salesPersionID As String) As String
        Dim promotion As New oSalesPerson
        Return promotion.DeleteJsonSalesPerson(dataBaseName, salesPersionID)
    End Function
    <WebMethod()> _
    Public Function GetAllSalesPerson(ByVal dataBaseName As String, ByVal companyCode As String, ByVal isAdmin As Boolean) As DataSet
        Dim promotion As New oSalesPerson
        Return promotion.GetAllSalesPerson(dataBaseName, companyCode, isAdmin)
    End Function
    <WebMethod()> _
    Public Function GetSalesPersonByID(ByVal dataBaseName As String, ByVal salesPersonID As String) As DataSet
        Dim promotion As New oSalesPerson
        Return promotion.GetSalesPersonByID(dataBaseName, salesPersonID)
    End Function
#End Region
#Region "oPromotionDocumentLinePropertyExclusive"
    <WebMethod()> _
    Public Function UpdateJsonPromotionDocumentLinePropertyEx(ByVal id As String, ByVal promotionID As String, _
                              ByVal propertyDetailID As String, _
                              ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionDocumentLinePropertyExclusive
        Return promotion.UpdateJsonPromotionDocumentLinePropertyEx(id, promotionID, propertyDetailID, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionDocumentLinePropertyEx(ByVal dataBaseName As String, ByVal id As String) As String
        Dim promotion As New oPromotionDocumentLinePropertyExclusive
        Return promotion.DeleteJsonPromotionDocumentLinePropertyEx(dataBaseName, id)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionDocumentLinePropertyExByPromotionID(ByVal dataBaseName As String, ByVal propertyID As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionDocumentLinePropertyExclusive
        Return promotion.GetAllPromotionDocumentLinePropertyExByPromotionID(dataBaseName, propertyID, promotionID)
    End Function
#End Region
#Region "oPromotionDocumentLinePropertyInclude"
    <WebMethod()> _
    Public Function UpdateJsonPromotionDocumentLinePropertyIn(ByVal id As String, ByVal promotionID As String, _
                              ByVal propertyDetailID As String, _
                              ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionDocumentLinePropertyInclude
        Return promotion.UpdateJsonPromotionDocumentLinePropertyIn(id, promotionID, propertyDetailID, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionDocumentLinePropertyIn(ByVal dataBaseName As String, ByVal id As String) As String
        Dim promotion As New oPromotionDocumentLinePropertyInclude
        Return promotion.DeleteJsonPromotionDocumentLinePropertyIn(dataBaseName, id)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionDocumentLinePropertyInByPromotionID(ByVal dataBaseName As String, ByVal propertyID As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionDocumentLinePropertyInclude
        Return promotion.GetAllPromotionDocumentLinePropertyInByPromotionID(dataBaseName, propertyID, promotionID)
    End Function
#End Region
#Region "oHierarchy"
    <WebMethod()> _
    Public Function GetAllHierarchy(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oHierarchy
        Return promotion.GetAllHierarchy(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetLastRecordHierarchy(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oHierarchy
        Return promotion.GetLastRecordHierarchy(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetHierarchyByID(ByVal dataBaseName As String, ByVal hierarchyID As String) As DataSet
        Dim promotion As New oHierarchy
        Return promotion.GetHierarchyByID(dataBaseName, hierarchyID)
    End Function
    <WebMethod()> _
    Public Function CreateHierarchy(ByVal dataBaseName As String, ByVal headerJson As String, ByVal hierarchyFatherID As String) As String
        Dim promotion As New oHierarchy
        Return promotion.CreateHierarchy(dataBaseName, headerJson, hierarchyFatherID)
    End Function
    <WebMethod()> _
    Public Function DeleteHierarchy(ByVal dataBaseName As String, ByVal hierarchyID As String) As String
        Dim promotion As New oHierarchy
        Return promotion.DeleteHierarchy(dataBaseName, hierarchyID)
    End Function
    <WebMethod()> _
    Public Function UpdateJsonHiererchy(ByVal hierarchyID As String, _
                                   ByVal hierarchyCode As String, ByVal hierarchyName As String, ByVal companyCode As String, _
                                   ByVal createdUserId As String, ByVal hierarchyType As String, ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oHierarchy
        Return promotion.UpdateJsonHiererchy(hierarchyID, hierarchyCode, hierarchyName, companyCode, createdUserId, hierarchyType, databaseName, isInsert)
    End Function
#End Region
#Region "oHierarchyDetail"
    <WebMethod()> _
    Public Function GetHierarchyDetailByHierarchyID(ByVal dataBaseName As String, ByVal hierarchyID As String) As DataSet
        Dim promotion As New oHierarchyDetail
        Return promotion.GetHierarchyDetailByHierarchyID(dataBaseName, hierarchyID)
    End Function
    <WebMethod()> _
    Public Function CreateHierarchyDetail(ByVal dataBaseName As String, ByVal hierarchyID As String, ByVal hierarchyDetailName As String, ByVal hierarchyFatherID As String) As String
        Dim promotion As New oHierarchyDetail
        Return promotion.CreateHierarchyDetail(dataBaseName, hierarchyID, hierarchyDetailName, hierarchyFatherID)
    End Function
    <WebMethod()> _
    Public Function DeleteHierarchyDetail(ByVal dataBaseName As String, ByVal hierarchyDetailID As String) As String
        Dim promotion As New oHierarchyDetail
        Return promotion.DeleteHierarchyDetail(dataBaseName, hierarchyDetailID)
    End Function
    <WebMethod()> _
    Public Function UpdateHierarchyDetail(ByVal dataBaseName As String, ByVal hierarchyDetailID As String, ByVal hierarchyDetailName As String) As String
        Dim promotion As New oHierarchyDetail
        Return promotion.UpdateHierarchyDetail(dataBaseName, hierarchyDetailID, hierarchyDetailName)
    End Function
#End Region
#Region "oPromotionItemPoint"
    <WebMethod()> _
    Public Function UpdateJsonPromotionItemPoint(ByVal id As String, ByVal promotionID As String, _
                                  ByVal sourceType As String, ByVal sourceValue As String, _
                                  ByVal getPoint As Double, ByVal basedValue As Double, ByVal basedType As String, _
                                  ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionItemPoint
        Return promotion.UpdateJsonPromotionItemPoint(id, promotionID, sourceType, sourceValue, getPoint, basedValue, basedType, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionItemPoint(ByVal dataBaseName As String, ByVal id As String) As String
        Dim promotion As New oPromotionItemPoint
        Return promotion.DeleteJsonPromotionItemPoint(dataBaseName, id)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionItemPointByPromotionID(ByVal dataBaseName As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionItemPoint
        Return promotion.GetAllPromotionItemPointByPromotionID(dataBaseName, promotionID)
    End Function
#End Region
#Region "dbo.oPromotionSalesPersonInclude"
    <WebMethod()> _
    Public Function UpdateJsonPromotionSalesPersonIn(ByVal lineID As String, ByVal promotionID As String, _
                               ByVal salesPersonID As String, _
                               ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionSalesPersonInclude
        Return promotion.UpdateJsonPromotionSalesPersonIn(lineID, promotionID, salesPersonID, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionSalesPersonIn(ByVal dataBaseName As String, ByVal lineID As String) As String
        Dim promotion As New oPromotionSalesPersonInclude
        Return promotion.DeleteJsonPromotionSalesPersonIn(dataBaseName, lineID)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionSalesPersonInByPromotionID(ByVal dataBaseName As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionSalesPersonInclude
        Return promotion.GetAllPromotionSalesPersonInByPromotionID(dataBaseName, promotionID)
    End Function
#End Region
#Region "oPromotionSalesPersonExclude"
    <WebMethod()> _
    Public Function UpdateJsonPromotionSalesPersonEx(ByVal lineID As String, ByVal promotionID As String, _
                              ByVal salesPersonID As String, _
                              ByVal databaseName As String, ByVal isInsert As Boolean) As String
        Dim promotion As New oPromotionSalesPersonExclude
        Return promotion.UpdateJsonPromotionSalesPersonEx(lineID, promotionID, salesPersonID, databaseName, isInsert)
    End Function
    <WebMethod()> _
    Public Function DeleteJsonPromotionSalesPersonEx(ByVal dataBaseName As String, ByVal lineID As String) As String
        Dim promotion As New oPromotionSalesPersonExclude
        Return promotion.DeleteJsonPromotionSalesPersonEx(dataBaseName, lineID)
    End Function
    <WebMethod()> _
    Public Function GetAllPromotionSalesPersonExByPromotionID(ByVal dataBaseName As String, ByVal promotionID As String) As DataSet
        Dim promotion As New oPromotionSalesPersonExclude
        Return promotion.GetAllPromotionSalesPersonExByPromotionID(dataBaseName, promotionID)
    End Function
#End Region
#Region "oReport"
    <WebMethod()> _
    Public Function GetReportThisYearVSLastYear(ByVal dataBaseName As String) As DataSet
        Dim promotion As New oReport
        Return promotion.GetReportThisYearVSLastYear(dataBaseName)
    End Function
    <WebMethod()> _
    Public Function GetAllUserDefinedReport(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oReport
        Return promotion.GetAllUserDefinedReport(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetAllReport(ByVal dataBaseName As String, ByVal companyCode As String) As DataSet
        Dim promotion As New oReport
        Return promotion.GetAllReport(dataBaseName, companyCode)
    End Function
    <WebMethod()> _
    Public Function GetReportByReportID(ByVal dataBaseName As String, ByVal reportID As String) As DataSet
        Dim promotion As New oReport
        Return promotion.GetReportByReportID(dataBaseName, reportID)
    End Function
    <WebMethod()> _
    Public Function CreateReport(ByVal dataBaseName As String, ByVal reportID As String, ByVal isUpdate As Boolean, ByVal headerJson As String, ByVal lineJson As String) As String
        Dim promotion As New oReport
        Return promotion.CreateReport(dataBaseName, reportID, isUpdate, headerJson, lineJson)
    End Function
    <WebMethod()> _
    Public Function DeleteReport(ByVal dataBaseName As String, ByVal reportID As String) As String
        Dim promotion As New oReport
        Return promotion.DeleteReport(dataBaseName, reportID)
    End Function
    <WebMethod()> _
    Public Function LoadUserDefinedReport(ByVal dataBaseName As String, ByVal reportID As String, ByVal jsonParams As String) As DataSet
        Dim promotion As New oReport
        Return promotion.LoadUserDefinedReport(dataBaseName, reportID, jsonParams)
    End Function
    <WebMethod()> _
    Public Function LoadReportParameterFromQuery(ByVal dataBaseName As String, ByVal reportDetailID As String) As DataSet
        Dim promotion As New oReport
        Return promotion.LoadReportParameterFromQuery(dataBaseName, reportDetailID)
    End Function
#End Region
#Region "oReportParameter"
    <WebMethod()> _
    Public Function GetReportParameterByReportID(ByVal dataBaseName As String, ByVal reportID As String) As DataSet
        Dim promotion As New oReportParameter
        Return promotion.GetReportParameterByReportID(dataBaseName, reportID)
    End Function
    <WebMethod()> _
    Public Function CreateReportParameter(ByVal dataBaseName As String, ByVal reportID As String, ByVal isUpdate As Boolean, ByVal lineJson As String) As String
        Dim promotion As New oReportParameter
        Return promotion.CreateReportParameter(dataBaseName, reportID, isUpdate, lineJson)
    End Function
#End Region
End Class